Telegram Group & Telegram Channel
#Basics

Transpose a Matrix

Transposing a matrix involves converting columns into rows. In python we can achieve it by designing some loop structure to iterate through the elements in the matrix and change their places or we can use the following script involving zip function in conjunction with the * operator to unzip a list which becomes a transpose of the given matrix.

Example:

x = [[31,17],
[40 ,51],
[13 ,12]]
print (zip(*x))

Output:
[(31, 40, 13), (17, 51, 12)]

Share and Support
@Python_Codes



tg-me.com/python_codes/190
Create:
Last Update:

#Basics

Transpose a Matrix

Transposing a matrix involves converting columns into rows. In python we can achieve it by designing some loop structure to iterate through the elements in the matrix and change their places or we can use the following script involving zip function in conjunction with the * operator to unzip a list which becomes a transpose of the given matrix.

Example:

x = [[31,17],
[40 ,51],
[13 ,12]]
print (zip(*x))

Output:
[(31, 40, 13), (17, 51, 12)]

Share and Support
@Python_Codes

BY Python Codes


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python_codes/190

View MORE
Open in Telegram


Python Codes Telegram | DID YOU KNOW?

Date: |

Telegram announces Anonymous Admins

The cloud-based messaging platform is also adding Anonymous Group Admins feature. As per Telegram, this feature is being introduced for safer protests. As per the Telegram blog post, users can “Toggle Remain Anonymous in Admin rights to enable Batman mode. The anonymized admin will be hidden in the list of group members, and their messages in the chat will be signed with the group name, similar to channel posts.”

Python Codes from ua


Telegram Python Codes
FROM USA